package com.dream.jump.ui.welcome


import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.dream.jump.data.DataRepository
import com.dream.jump.file.FileConfig
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class WelcomeViewModel @Inject constructor(
    private val dataRepository: DataRepository,
    private val fileConfig: FileConfig
) : ViewModel() {
    private val _welcomeResult = MutableLiveData<WelcomeResult>()
    var welcomeResult: LiveData<WelcomeResult> = _welcomeResult
    fun initData() {
        fileConfig.createFile()
        dataRepository.initRetrofitApi(fileConfig.readSystemJson())
        _welcomeResult.value = WelcomeResult(result = true, message = "初始化成功")
    }
}